'use strict';
const {getDefaultModelConfig} = require("../../utils/common");

module.exports = app => {
    const { STRING, INTEGER, BIGINT } = app.Sequelize;
    return app.model.define(
        'User',
        {
            id: { type: BIGINT, primaryKey: true, autoIncrement: true },
            openid: STRING(255),
            phone: STRING(255),
            password: STRING(255),
            nickname: STRING(255),
            avatar_url: STRING(255),
            status: {type: INTEGER, defaultValue: 1},
            ...getDefaultModelConfig(app)
        },
        {
            tableName: 'user',
            timestamps: true,
            createdAt: 'create_time',
            updatedAt: 'update_time'
        }
    );
};
